package dao.impl;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import vo.Address;
import dao.AddressDao;

@Repository("ad")
public class AddressDaoImpl implements AddressDao{
	@PersistenceContext(name="un")
	private EntityManager em;

	@Override
	@Transactional
	public int update(Address  address) {
		/*String jpql = "insert Address a set a.city=:city,a.province=:province where a.addressid=:addressid";
		int rs = em.createQuery(jpql)
				.setParameter("city", address.getCity())
				.setParameter("province", address.getProvince())
				.setParameter("addressid",address.getStreet())
				.executeUpdate();*/
		 em.persist(address);
		 return address.getAddressId();
	}

}
